<?php
	require_once("../../includes/user.php");
	$user=new User();
	if($_POST['role']==1)
	{
		$user_res=$user->query("select * from user_profile where role=1 AND accept=1 AND year='$_POST[year]' AND block=0 ORDER BY regno");
		while($user_row=mysql_fetch_array($user_res))
		{
			echo '<option value="'.$user_row['id'].'">'.$user_row['name'].'</option>'; 
		}
	}
	elseif($_POST['role']==2)
	{
		$user_res=$user->query("select * from user_profile where role=2 AND accept=1 AND block=0 ORDER BY name");
		while($user_row=mysql_fetch_array($user_res))
		{
			echo '<option value="'.$user_row['id'].'">'.$user_row['name'].'</option>'; 
		}
	}
	if(isset($_POST['userid'])&&$_POST['userid']!=0)
	{
	$p_row=$user->getUserProfile($_POST['userid']);
		?>
<link href="../css/default.css" rel="stylesheet" type="text/css" />

        <table width="424" height="130" border="0" align="center" cellpadding="0" cellspacing="0" class="profile">
  <tr>
    <td width="171" align="right" valign="middle" class="head">Name :</td>
    <td width="253" height="10" align="left" valign="middle" class="profile"><?php echo $p_row['name']; ?></td>
  </tr>
  <tr align="right" class="head">
    <td height="10" colspan="2" valign="middle" class="profile">&nbsp;</td>
  </tr>
  <?php if($p_row['role']==1){ ?>
  <tr>
    <td align="right" valign="middle" class="head">Reg no :</td>
    <td height="10" align="left" valign="middle" class="profile"><?php 
	echo $p_row['regno']; ?></td>
  </tr>
  <tr align="right" class="head">
    <td height="20" colspan="2" valign="middle" class="profile">&nbsp;</td>
  </tr>
  <?php } ?>
  <tr>
    <td height="20" align="right" valign="middle" class="head"><?php if($p_row['role']==1){ ?>
      Year
    <?php }elseif($p_row['role']==2){?>Desg<?php }?>:</td>
    <td height="20" align="left" valign="middle" class="profile"><?php
	if($p_row['role']==1){
	echo $user->getYear($p_row['year']);
			    ?> CSE<?php }elseif($p_row['role']==2){echo $p_row['desg'];}?></td>
  </tr>
  <tr align="right" class="head">
    <td height="10" colspan="2" valign="middle" class="profile">&nbsp;</td>
  </tr>
  <?php if($p_row['role']==1){ ?>
  <tr>
    <td align="right" valign="middle" class="head">House :</td>
    <td height="10" align="left" valign="middle" class="profile"><?php echo $user->getHouse($p_row['house']); ?></td>
  </tr>
  <tr align="right" class="head">
    <td height="10" colspan="2" valign="middle" class="profile">&nbsp;</td>
  </tr>
  <?php } ?>
  <tr>
    <td align="right" valign="middle" class="head">Commitee :</td>
    <td height="10" align="left" valign="middle" class="profile"><?php echo $user->getCommitee($p_row['commitee']); ?></td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="head">&nbsp;</td>
    <td height="10" align="left" valign="middle" class="profile">&nbsp;</td>
  </tr>
  <tr>
    <td align="right" valign="middle" class="head">&nbsp;</td>
    <td height="10" align="left" valign="middle" class="profile"><span class="smartlink" onclick="blockit(<?php echo $_POST['userid']; ?>)">Block</span></td>
  </tr>
</table>
<?php
	}
?>